
// Copyright (C) 2007 Richard Uhler
// This file is part of Esiply.
//
// Esiply is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, Version 2,
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef _COMPLETION_STATEMENT_H_
#define _COMPLETION_STATEMENT_H_

// A completion statement is one of throw, return, break, or continue.
// It consists of a completion type, an optional expression to evaluate
// which becomes the completion value, and an optional identifier
// which becomes the completion target
#include "Completion.h"
#include "Statement.h"

class Expression;

class CompletionStatement : public Statement
{
public:
    // target follows standard identifier expression procedure.
    // both value and target are optional (they may be NULL, in which
    // case empty will be used instead).
    CompletionStatement(CompletionType ct, Expression* value, String* target);

    virtual Value* execute_internal(Scope* scope) const;

private:
    CompletionType m_ct;
    Expression* m_value;
    String* m_target;
};

#endif//_COMPLETION_STATEMENT_H_

